\hypertarget{group__nxbot__commK}{
\section{COMMK Library}
\label{group__nxbot__commK}\index{COMMK Library@{COMMK Library}}
}


Communication library for implementing the serial protocol used for communication with the Linux-\/embbeded system of NXBot.  


\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structstream}{stream}
\begin{DoxyCompactList}\small\item\em Structure for defining the stream data. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__nxbot__commK_ga782d8d9b5e3ede5a7ca9bd88df3c68f0}{COMMK\_\-DATASIZE}~40
\begin{DoxyCompactList}\small\item\em Max. Size of data in stream. \item\end{DoxyCompactList}\item 
\#define \hyperlink{group__nxbot__commK_gaf5585ddbb22b8bdd9a3aea2bdad05de1}{COMMK\_\-EXTRAFIELDS}~3
\begin{DoxyCompactList}\small\item\em Number of extra fields included in the stream. \item\end{DoxyCompactList}\item 
\#define \hyperlink{group__nxbot__commK_ga23e0a68452196a321b55f7711fb4e13a}{TX\_\-STREAM\_\-OK}~0
\begin{DoxyCompactList}\small\item\em Flag indicating that the stream has been transmitted. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__nxbot__commK_ga2cd6d5b2d41e59393ca658d6494469fd}{comm\_\-init} (unsigned int baudrate, unsigned char format, unsigned char usart)
\begin{DoxyCompactList}\small\item\em Initialization of communiication hardware. \item\end{DoxyCompactList}\item 
unsigned char \hyperlink{group__nxbot__commK_ga7107d874f14ed410bec1e5ed5ba70046}{comm\_\-transmit} (\hyperlink{structstream}{stream} $\ast$txStream, uint8\_\-t usart)
\begin{DoxyCompactList}\small\item\em Transmit a stream via the selected uart. \item\end{DoxyCompactList}\item 
unsigned char \hyperlink{group__nxbot__commK_gac45e24bbf01332b2f75b3635aec2eb62}{comm\_\-receive} (\hyperlink{structstream}{stream} $\ast$rxStream, uint8\_\-t usart)
\begin{DoxyCompactList}\small\item\em Receive a stream via the selected uart. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Communication library for implementing the serial protocol used for communication with the Linux-\/embbeded system of NXBot. 
\begin{DoxyCode}
 #include <commK.h> 
\end{DoxyCode}
 This module relies on the UART library from the \hyperlink{group__nxbot__low__level}{LOW Layer}. It implements a fashion-\/like khepera protocol. Not all the commands are compatible. The idea behind using this protocol was the facility for debugging the code using a simple serial connection and ASCII-\/like command and data. This module implements only the Data Link Layer. The application Layer is implemented in the \hyperlink{group__nxbot__commTask}{COMMTASK Library} module. 

\subsection{Define Documentation}
\hypertarget{group__nxbot__commK_ga782d8d9b5e3ede5a7ca9bd88df3c68f0}{
\index{nxbot\_\-commK@{nxbot\_\-commK}!COMMK\_\-DATASIZE@{COMMK\_\-DATASIZE}}
\index{COMMK\_\-DATASIZE@{COMMK\_\-DATASIZE}!nxbot_commK@{nxbot\_\-commK}}
\subsubsection[{COMMK\_\-DATASIZE}]{\setlength{\rightskip}{0pt plus 5cm}\#define COMMK\_\-DATASIZE~40}}
\label{group__nxbot__commK_ga782d8d9b5e3ede5a7ca9bd88df3c68f0}


Max. Size of data in stream. 

\hypertarget{group__nxbot__commK_gaf5585ddbb22b8bdd9a3aea2bdad05de1}{
\index{nxbot\_\-commK@{nxbot\_\-commK}!COMMK\_\-EXTRAFIELDS@{COMMK\_\-EXTRAFIELDS}}
\index{COMMK\_\-EXTRAFIELDS@{COMMK\_\-EXTRAFIELDS}!nxbot_commK@{nxbot\_\-commK}}
\subsubsection[{COMMK\_\-EXTRAFIELDS}]{\setlength{\rightskip}{0pt plus 5cm}\#define COMMK\_\-EXTRAFIELDS~3}}
\label{group__nxbot__commK_gaf5585ddbb22b8bdd9a3aea2bdad05de1}


Number of extra fields included in the stream. 

\hypertarget{group__nxbot__commK_ga23e0a68452196a321b55f7711fb4e13a}{
\index{nxbot\_\-commK@{nxbot\_\-commK}!TX\_\-STREAM\_\-OK@{TX\_\-STREAM\_\-OK}}
\index{TX\_\-STREAM\_\-OK@{TX\_\-STREAM\_\-OK}!nxbot_commK@{nxbot\_\-commK}}
\subsubsection[{TX\_\-STREAM\_\-OK}]{\setlength{\rightskip}{0pt plus 5cm}\#define TX\_\-STREAM\_\-OK~0}}
\label{group__nxbot__commK_ga23e0a68452196a321b55f7711fb4e13a}


Flag indicating that the stream has been transmitted. 



\subsection{Function Documentation}
\hypertarget{group__nxbot__commK_ga2cd6d5b2d41e59393ca658d6494469fd}{
\index{nxbot\_\-commK@{nxbot\_\-commK}!comm\_\-init@{comm\_\-init}}
\index{comm\_\-init@{comm\_\-init}!nxbot_commK@{nxbot\_\-commK}}
\subsubsection[{comm\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void comm\_\-init (
\begin{DoxyParamCaption}
\item[{unsigned int}]{baudrate, }
\item[{unsigned char}]{format, }
\item[{unsigned char}]{usart}
\end{DoxyParamCaption}
)}}
\label{group__nxbot__commK_ga2cd6d5b2d41e59393ca658d6494469fd}


Initialization of communiication hardware. 

Initializes the uart hardware, by using the \hyperlink{group__nxbot__uart}{UART Library} module.


\begin{DoxyParams}{Parameters}
{\em baudrate} & Calculated using the \hyperlink{group__nxbot__uart_ga367ff7b5de225ed936a63239ad4adb0b}{UART\_\-BAUD\_\-SELECT()} function. \\
\hline
{\em format} & One of the UART\_\-FORMAT\_\- constants. \\
\hline
{\em usart} & Uart hardware to be used (0 or 1).\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__nxbot__uart}{UART Library} 
\end{DoxySeeAlso}
\hypertarget{group__nxbot__commK_gac45e24bbf01332b2f75b3635aec2eb62}{
\index{nxbot\_\-commK@{nxbot\_\-commK}!comm\_\-receive@{comm\_\-receive}}
\index{comm\_\-receive@{comm\_\-receive}!nxbot_commK@{nxbot\_\-commK}}
\subsubsection[{comm\_\-receive}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char comm\_\-receive (
\begin{DoxyParamCaption}
\item[{{\bf stream} $\ast$}]{rxStream, }
\item[{uint8\_\-t}]{usart}
\end{DoxyParamCaption}
)}}
\label{group__nxbot__commK_gac45e24bbf01332b2f75b3635aec2eb62}


Receive a stream via the selected uart. 


\begin{DoxyParams}{Parameters}
{\em rxStream} & The received stream. \\
\hline
{\em usart} & Uart module to be used for the reception. \\
\hline
\end{DoxyParams}
\hypertarget{group__nxbot__commK_ga7107d874f14ed410bec1e5ed5ba70046}{
\index{nxbot\_\-commK@{nxbot\_\-commK}!comm\_\-transmit@{comm\_\-transmit}}
\index{comm\_\-transmit@{comm\_\-transmit}!nxbot_commK@{nxbot\_\-commK}}
\subsubsection[{comm\_\-transmit}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char comm\_\-transmit (
\begin{DoxyParamCaption}
\item[{{\bf stream} $\ast$}]{txStream, }
\item[{uint8\_\-t}]{usart}
\end{DoxyParamCaption}
)}}
\label{group__nxbot__commK_ga7107d874f14ed410bec1e5ed5ba70046}


Transmit a stream via the selected uart. 


\begin{DoxyParams}{Parameters}
{\em txStream} & The stream to be sended. \\
\hline
{\em usart} & Uart module to be used for the transmission. \\
\hline
\end{DoxyParams}
